<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>取得图像宽度</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.imagesx" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagesx</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imagesx</span> &mdash; <span class="dc-title">取得图像宽度</span></p>

 </div>
 <div class="refsect1 unknown-unknown-unknown-unknown-notew" id="refsect1-function.imagesx-unknown-unknown-unknown-unknown-notew">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagesx</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
   ) : <span class="type">int</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imagesx()</strong></span> 返回
   <code class="parameter">image</code> 所代表的图像的宽度。
  </p>
  <div class="example" id="example-3740">
   <p><strong>Example #1 使用 <span class="function"><strong>imagesx()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;create&nbsp;a&nbsp;300*200&nbsp;image<br /></span><span style="color: #0000BB">$img&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">300</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">200</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;300<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

  </div>
  <p class="para">
   参见 <span class="function"><a href="imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a></span>，<span class="function"><a href="getimagesize.html" class="function">getimagesize()</a></span>
   和 <span class="function"><a href="imagesy.html" class="function">imagesy()</a></span>。
  </p>
 </div>

</div></div></div></body></html>